<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<title>Travel Dream</title>
</h:head>
<link
rel="stylesheet"
href="customerHome.css"
type="text/css"
media="all"/>

<h:body>
	<div id="templatemo_maincontainer">
<div id="templatemo_topsection">
  <div id="templatemo_title">TRAVEL Dream COMPANY</div>
  <div id="templatemo_slogan">The best way to travel !</div>
  <div id="hello"><h:outputText value="Hello #{userBean.getName()} !" /></div>
 
</div>
<div id="templatemo_left_column">
  <div id="templatemo_menu_top"></div>
  <div class="templatemo_menu"> 
  <ul>
 	 <li><a href="customerHome.xhtml">Home</a></li>
    <li><a href="myTravels.xhtml">My Travels<f:param name="user_ID" value ="#{userBean.getUsername()}"></f:param> </a></li>
    <li><a href="myInvitations.xhtml">My Invitations</a></li>
    <li><a href= "../logoutRedirect.xhtml">Logout</a></li>
  </ul></div>
  <div id="templatemo_contact">
    <strong>QUICK CONTACT<br /></strong>
Tel: 001-100-1000<br />
Fax: 002-200-2000<br />
Email: info[at]traveldream.com</div>
</div>
<div id="templatemo_right_column">
  <div class="innertube">
    <h1>Welcome to Travel Dream</h1>
    <p>Bellow you can discover all our predefined travel packages. All these travels are for a week (7 days- 6 nights). You can choose one and personalize it setting your departure and return dates, changing excursions, hotels and even the means of transportation. </p>
   </div>
<div class = "table">
<h:form id="form">  
              
    <p:dataList value="#{tableBean.getModel()}" var="travel" id="travels"  
        paginator="true" rows="5"  
        paginatorTemplate="{PreviousPageLink} {CurrentPageReport} {NextPageLink} {RowsPerPageDropdown}"  
        rowsPerPageTemplate="5,10,15" type="none">  
  
            <f:facet name="header">  
                Predefined Travel Packages  
            </f:facet>  
  
            <p:commandButton icon="ui-icon-search" update=":form:travelDetail" oncomplete="PF('travelDialog').show()" title="View Detail">  
                <f:setPropertyActionListener value="#{travel}" target="#{tableBean.selectedTravel}" />  
            </p:commandButton>  
  
            <h:outputText value="#{travel.getMeanOfTransportation1().getTrip().getDeparturePlace()} - #{travel.getMeanOfTransportation1().getTrip().getArrivalPlace()}" style="margin-left:10px" />  
           <br />  
           <h:outputText value=" Excursions : #{travel.getExcursionsList()}" style="margin-left:40px" />  
           
            <br />  
           <h:outputText value="#{travel.getPrice(6)} euros " style="margin-left:40px" /> 
            <h:commandButton action="personalize.xhtml?predefinedTP_ID" value="Personalize" style="margin-left:300px">
            	<f:param name="predefinedTP_ID" value ="#{travel.getID()}"></f:param> 
            	<f:param name="user_ID" value ="#{userBean.getUsername()}"></f:param> 
            	
            	</h:commandButton>

            <br />
    </p:dataList>  
      
    <p:dialog header="Travel Detail" widgetVar="travelDialog" modal="true" showEffect="fade">  
        <p:outputPanel id="travelDetail" style="text-align:center;" layout="block">  

              
            <h:panelGrid  columns="2" cellpadding="5">  
                
                
                
                <h:outputLabel for="hotel" value="Hotel : " />  
                <h:outputText id="hotel" value="#{tableBean.selectedTravel.getHotelBean().getDescription()}" />  
              
               <h:outputLabel for="transportation1" value="Transportation To Go : " />  
                <h:outputText id="transportation1" value="#{tableBean.selectedTravel.getMeanOfTransportation1().toString()}" />  
              
               <h:outputLabel for="transportation2" value="Transportation To Come Back : " />  
                <h:outputText id="transportation2" value="#{tableBean.selectedTravel.getMeanOfTransportation2().toString()}" />  
              
            </h:panelGrid>  
        </p:outputPanel>  
    </p:dialog>  
  
</h:form>  
   </div>                   

  <div id="templatemo_search">

 <div class="search_top"></div>
    <div class="sarch_mid">
      <h:form id="form1" name="form1" method="post" action="">
        <table width="247">

          <tr>
            <td><strong>From :</strong></td>
            <td><label>
              <p:inputText type="text" name="destination_from" id="destination_from" value="#{tableBean.from}" />
            </label></td>
          </tr>
          <tr>
            <td><strong>To :</strong></td>
            <td><label>
              <p:inputText type="text" name="destination_to" id="destination_to" value="#{tableBean.to}"/>
            </label></td>
          </tr>
         
            
          <tr>
            <td>       
            <p:commandButton icon="ui-icon-search" value="Search"  actionListener="#{tableBean.refreshList()}" update=":form:travels"/>  
          </td>
            
          </tr>
        </table>
        </h:form>
      </div>
      
       <div class="search_bot">
      <h:form id="form2" name="form2" method="post" action="">
        <table width="247">

          <tr>
            <td><strong>Search a invitation with the invitation code :</strong></td>
            <td><label>
              <p:inputText type="text" name="invitationCode" id="invitationCode" value="#{tableBean.invitationCode}" />
            </label></td>
          </tr>

          <tr>
            <td>       
            <p:commandButton icon="ui-icon-search" value="Search"  actionListener="#{tableBean.displayInvitationCustomer(userBean.getUsername())}" update=":invitationDetail" oncomplete="PF('invitationDialog').show()"  />  
          </td>
      
           
          </tr>
          
                
          
        </table>
        </h:form>
      </div>
      <div class="search_bottom">
      	<h:outputText value=""></h:outputText>
      	<br/>
      </div>
      
 
  <p:dialog header="Invitation Detail" widgetVar="invitationDialog" modal="true" showEffect="fade">  
        <p:outputPanel id="invitationDetail" style="text-align:center;" layout="block">  

              
            <h:panelGrid  columns="2" cellpadding="5">  
                
                <h:outputText value="#{tableBean.travelCorrespondingToInvitation.getMeanOfTransportation1().getTrip().getDeparturePlace()} - #{tableBean.travelCorrespondingToInvitation.getMeanOfTransportation1().getTrip().getArrivalPlace()}" style="margin-left:10px" />  
           		<br/>
           		<h:outputLabel for="excursions" value="Excursions : " /> 
           		<h:outputText value=" #{tableBean.travelCorrespondingToInvitation.getExcursionsList()}" style="margin-left:10px" />  
           
                <h:outputLabel for="hotel" value="Hotel : " />  
                <h:outputText id="hotel" value="#{tableBean.travelCorrespondingToInvitation.getHotelBean().getDescription()}" />  
              
               <h:outputLabel for="transportation1" value="Transportation To Go : " />  
                <h:outputText id="transportation1" value="#{tableBean.travelCorrespondingToInvitation.getMeanOfTransportation1().toString()}" />  
              
               <h:outputLabel for="transportation2" value="Transportation To Come Back : " />  
                <h:outputText id="transportation2" value="#{tableBean.travelCorrespondingToInvitation.getMeanOfTransportation2().toString()}" />  
         
         		<h:outputLabel for="departureDate" value="Departure Date : " />  
                <h:outputText id="departureDate" value="#{tableBean.travelCorrespondingToInvitation.getDateOfDepartureFormat()}" />  
        
       			 <h:outputLabel for="returnDate" value="Return Date : " />  
                <h:outputText id="returnDate" value="#{tableBean.travelCorrespondingToInvitation.getDateOfReturnFormat()}" />  
        
            	<h:outputLabel for="cost" value="Cost : " />  
            	<h:outputText value="#{tableBean.travelCorrespondingToInvitation.getPrice()} euros" style="margin-left:40px" /> 
            </h:panelGrid>  
        </p:outputPanel>  
    </p:dialog>  
    
  </div>
</div>

</div>
<div id="templatemo_footer">TravelDream Company</div>




    </h:body>
</html>


